mod learning;
use learning::control_flow::control_flow;
use learning::enum_test;
use learning::struct_test;
use learning::tuples_test;
use learning::owner_ship;
use learning::string_test;
use learning::vector_test;
use learning::hash_map_test;
use learning::traits;
    /**
     * 主函数
     * 1.变量声明 
     */ 
fn main() {
    // int 整形
    // i开头的是有符号的，u开头的是无符号
    // 声明一个  32位的int类型
    let _inum = 1; // 默认i32
    let _inum:i32 = 1;
    // 声明一个  64位的int类型
    let _inum:u64 = 1;
    // 声明一个  64位的int类型

    let _unum:u128 = 1;
    // size 和系统架构有关
    let _unum:usize = 1;
    let _unum:isize = 1;

    // float 浮点型
    let _fnum = 1.1; // 默认f64
    let _fnum:f32 = 1.1;
    let _fnum:f64 = 1.1;

    // 布尔型
    let _bl:bool = true;
    let _bl = true;
    let _bl = false;

    let _emoji = '\u{1F601}'; // 字符型 ,单引号
    let _a:char = 'a'; // 字符型
    let _b = "b"; // 字符串型
    let _c:&str = "c"; // 字符串型
    print!("Hello \n world! \n"); // 无换行
    println!("Hello \n world! \n"); // 有换行
    println!("{}b{}{}", _a,_c,_emoji);


    // 从命令行读取输入
    let x1:f64 = 0.1;
    let x2:f64 = 0.2;
    let x:f64 = x1+x2;
    let s: String = x.to_string();
    println!("{}dddd{}", s,s);



    control_flow::test_while();
    control_flow::test_loop();
    control_flow::test_match();
    let res = control_flow::base_function();
    println!("{}",&res);
    let res = control_flow::closure_function();
    println!("{}",&res);

    enum_test::print_user_status();
    struct_test::main();
    tuples_test::main();
    owner_ship::main();
    string_test::main();
    vector_test::main();
    hash_map_test::main();
    traits::main();
}

